POV-Ray : Newsgroups : povray.programming : Yet another slight improvement (pattern.cpp - quilt_cubic) : Yet another slight improvement (pattern.cpp - quilt_cubic) Server Time
8 Jul 2024 19:00:39 EDT (-0400)
  Yet another slight improvement (pattern.cpp - quilt_cubic)  
From: Tony[B]
Date: 29 Dec 2002 21:26:41
Message: <3e0faee1@news.povray.org>
Came up with it today (Dec. 29). I know it's not a significant improvement,
but at least it shouldn't hurt. With the current implementation, it takes 10
multiplications and 3 additions/subtractions. My version shaves 3
multiplications off the process... not to mention that it eliminates a bunch
of temporaries, which I believe were only there for self-documentation, when
instead you could simply spell it out in the comments.

DBL quilt_cubic(DBL t, DBL p1, DBL p2)
{
 DBL it = 1.0 - t;

 return (t * (t*t + 3.0*it*(it*p1 + t*p2) ) * INV_SQRT_3_4);
}

--
Anthony Bennett


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.